<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <body>
        <ui:composition template="./../Template/generalTemplate.xhtml">

            <ui:define name="content">
                <f:view beforePhase="#{quotationForConfirmManagedBean.initView}">
                    <h:form id="form">
                         
                        <p:panel id="quotationR" header="Sales Quotation View" style="height:495px;">
                            <div style="margin-bottom:20px;margin-top:20px;margin-left:50px;margin-right:50px;">
                                <h4>
                                    <h:outputText value="Company Name:   "/>
                                    <h:outputText value="#{quotationForConfirmManagedBean.selectedCompany.getName()}"/>
                                </h4>
                                <p:dataTable id="lineItems" value="#{quotationForConfirmManagedBean.lineItemList}" var="returnLineItem">

                                    <p:column headerText="Product Type">
                                        <h:outputText value="#{returnLineItem.product.productName}"/>
                                    </p:column>

                                    <p:column headerText="Required Quantity">
                                        <h:outputText value="#{returnLineItem.quantity}"/>
                                    </p:column>
                                    <p:column headerText="Lead Time">
                                        <h:outputText value="#{returnLineItem.leadTime}"/>
                                    </p:column>
                                    <p:column headerText="Unit Price(after discount)">
                                        <h:outputText value="#{returnLineItem.price}"/>
                                    </p:column>

                                </p:dataTable>
                                <br /><br />

                                <div id="quotationConfirmBottom">
                                    <h:outputText value="Valid Until(dd-mm-yyyy):" />
                                    <h:outputText value="#{quotationForConfirmManagedBean.validUntil}">  
                                     <f:convertDateTime pattern="dd-MM-yyyy" />
                                    </h:outputText>
                                    <br></br>

                                    <h:outputText value="User Discount:" />  
                                    <h:inputText value="#{quotationForConfirmManagedBean.userDiscount}"/>
                                    <p:spacer width="10" />
                                    <p:commandButton   title="Update"  ajax="true" actionListener="#{quotationForConfirmManagedBean.checkLimit}" update="tp as"  image="ui-icon ui-icon-refresh"/>
                                  
                                   
                                    <br></br>
                                    
                                    <h:panelGrid id="tp" columns="3">
                                   
                                        <h:outputText value="Total Price:" style="font-weight: bold;" />
                                        <h:outputText  value="#{quotationForConfirmManagedBean.returnTotalPrice()}" style="font-weight: bold;"/> 
                                        <br /><br />
                                    <p:commandButton value="Confirm" actionListener="#{quotationForConfirmManagedBean.saveNewQuotation}"/>
                                      
                                        
                                     
                                    </h:panelGrid>
 <p:messages id="as"/>
                                </div>

                            </div>
                        </p:panel>

                    </h:form>  
                </f:view>
            </ui:define>
        </ui:composition>
    </body>
</html>